<?php

namespace seecms\carousel\controller;

use seecms\controller\Resource;
use seecms\lib\builder\column\ImageColumn;
use seecms\lib\builder\control\ImageControl;
use seecms\lib\builder\control\InputControl;

class Carousel extends Resource
{
    protected $title = '轮播图';

    protected $table_name = 'see_carousel';

    protected $dictionary_name = 'carousel';

    public function pageTitle(): string
    {
        return __('carousel.page_title');
    }

    public function query(): array
    {
        return [
            'name',
            'scene',
            'begin_time',
            'end_time',
            'status',
        ];
    }

    public function columns(): array
    {
        return [
            'id',
            'name',
            ImageColumn::init('path'),
            'redirect',
            'description',
            'scene',
            'begin_time',
            'end_time',
            'sort',
            'status',
            'created_at',
        ];
    }

    public function controls(): array
    {
        return [
            'name',
            ImageControl::init('path'),
            'redirect.false',
            'description.false',
            InputControl::init('scene')->setRequired()->setDescription('如:web(官网) mobile(移动端) index(首页) app(手机应用) mini(小程序) 多个用空格隔开'),
            'begin_time',
            'end_time',
            'sort',
            'status',
        ];
    }
}